<!-- 列表页分类 -->
<template>
  <div class="header_list">
    <el-row style="margin-top: 5px; margin-bottom: 5px;">
      <el-col :span="12">
        <div class="grid-content bg-purple">
          <ul class="detail_header clearfix">
            <li>
              <nuxt-link :to="{name: 'index'}">首页</nuxt-link>
              <span>></span>
            </li>
            <li>
              新闻公告
            </li>
          </ul>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="grid-content bg-purple-light">
          <div class="search-position">
            <search-input :search-key="searchKey" @search="handleSearch" />
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import SearchInput from '@/components/common/SearchInput'
export default {
  components: {
    SearchInput
  },
  props: {
    searchKey: {
      type: String,
      default() {
        return ''
      }
    }
  },
  data() {
    return {
    }
  },
  mounted() {
  },
  methods: {
    handleSearch(mingcheng) {
      this.mingcheng = mingcheng
      this.goList()
    },
    goList() {
      const mingcheng = this.mingcheng
      const leixing = this.$route.query.leixing
      const _dc = Math.random()
      const p = {
        path: this.$route.path,
        query: {
          mingcheng,
          leixing,
          _dc
        }
      }

      if (!mingcheng) {
        delete p.query.mingcheng
      }

      if (!leixing) {
        delete p.query.leixing
      }
      // if (this.courseType === 'course') {
      this.$router.push(p)
      // }
    }
  }
}
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
.header_list {
  position: relative;
  margin: 0 auto;
  width: 1200px;
  /* border-top: 1px solid rgb(215, 215, 215); */
  /* background: #f6f8fb; */

  .list_content {
    margin: 0 auto;
    // height: 73px;
    border-bottom: 1px solid rgb(215, 215, 215);
    position: relative;

    &:last-child {
      border-bottom: none;
    }

    span {
      position: absolute;
      display: inline-block;
      font-size: 14px;
      font-weight: bold;
      height: 26px;
      line-height: 26px;
      top: 23px;
    }
  }
}

.content_ul {
  display: inline-block;
  // margin-left: 60px;
  margin-top: 23px;

  li {
    float: left;
    font-size: 14px;
    height: 26px;
    line-height: 26px;
    padding: 0 6px;
    border-radius: 6px;
    margin: 0 6px;

    a:hover {
      color: red;
      text-decoration: none;
    }

    &.now {
      background: #D51423;

      a {
        color: #fff;
      }
    }
  }
}

.detail_header {
  li {
    float: left;
    line-height: 57px;
    margin: 0 0;
    margin-left: 10px;
    color: #999;
    font-size: 14px;

    span {
      margin-left: 10px;
      margin-right: 10px;
    }

    a {
      color: #999;

      &:hover {
        text-decoration: none;
      }
    }
  }
}

.search-position {
  display: flex;
  /* justify-content: center; */
  align-items: center;
  height: 57px;
  float: right;
}
</style>
